﻿using Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 纺织贸易管理系统;
using 纺织贸易管理系统.设置窗体;

namespace 后整理管理系统.入库管理
{
    public partial class 出库信息 : Sunny.UI.UIForm
    {
        public string Danhao { get; set; }
        public string LotNo { get; set; }
        public 出库信息()
        {
            InitializeComponent();
            CreateGrid.Create("销售发货单", gridView1);
            gridView1.Columns["IsDone"].Visible = false;
            gridView1.Columns["danhao"].Visible = true;
            gridView1.Columns["danhao"].Caption = "单据类型";
            gridView1.Columns["danhao"].Width = 100;
            gridView1.Columns["rq"].Visible = true;
            gridView1.Columns["rq"].Caption = "日期";
            gridView1.Columns["rq"].Width = 100;
        }

        private void 出库信息_Load(object sender, EventArgs e)
        {
            var mingxis = Connect.dbcontext.Queryable<danjumingxitable>().Where(x=>x.rkdh==Danhao&&x.ganghao==LotNo&&x.danhao.Contains (FirstLetter.销售发货单)).ToList ();
            mingxis.AddRange(Connect.dbcontext.Queryable<danjumingxitable>().Where(x => x.rkdh == Danhao && x.ganghao == LotNo && x.danhao.Contains(FirstLetter.生产退卷单)).ToList());
            foreach(var m in mingxis)
            {
                m.danhao = m.danhao.Contains(FirstLetter.销售发货单) ? DanjuLeiXing.销售出库单 : DanjuLeiXing.退卷单;
            }
            gridControl1.DataSource = mingxis;
        }
    }
}
